<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="../plugins/elementui/index.css">
</head>
<body>

<div id="app">
    <input type="button" value="新增" v-on:click="toAdd">


    <el-dialog title="新增检查组" :visible.sync="dialogFormVisibleAdd">
        <el-tabs v-model="activeName">
            <el-tab-pane label="检查组基本信息" name="first">
                <input type="text" v-model="formData.code">
                <br>
                <input type="text" v-model="formData.name">
                <br>
                <select v-model="formData.sex">
                    <option value="1">男</option>
                    <option value="2">女</option>
                </select>

            </el-tab-pane>

            <el-tab-pane label="检查项" name="second">

                <table>
                    <tr v-for="item in checkItems">
                        <td>
                            <input type="checkbox" :value="item.id" v-model="aa">
                        </td>
                        <td>{{item.code}}</td>
                        <td>{{item.name}}</td>
                    </tr>
                </table>


            </el-tab-pane>
        </el-tabs>
    </el-dialog>

</div>

<script src="../js/vue.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script>
    let vm  = new Vue({
        el:"#app",
        data:{
            dialogFormVisibleAdd:false,
            formData:{},
            activeName:"first",
            checkItems:[],
            aa:[]
        },
        methods:{
            toAdd(){
                //弹框
                this.dialogFormVisibleAdd = true;
                //查询所有的检查项
                axios.get("/checkitem/findAll.do").then((res)=>{
                    //res.data={flag:boolean,message:string,data:object}
                    // console.log(this.checkItems instanceof Array)
                    this.checkItems = res.data.data;
                    // console.log(this.checkItems instanceof Array)
                })
            }
        }

    })

</script>
</body>
</html>
